//
//  CalculationPAVCell.m
//  EMMApp
//
//  Created by Mac on 16/7/10.
//  Copyright © 2016年 YiXun. All rights reserved.
//

#import "CalculationPAVCell.h"
#import "ZFChart.h"
@interface CalculationPAVCell ()<ZFGenericChartDataSource, ZFBarChartDelegate>
{
    NSIndexPath *path;
    UUChart *chartView;
    NSMutableArray *xArr;
    NSMutableArray*oXArr;
    NSMutableArray*oArr;
    NSMutableArray *tArr;
}


@property (nonatomic, strong) ZFBarChart1 * barChart;

@property (nonatomic, assign) CGFloat height;
@end

@implementation CalculationPAVCell


- (void)initWithXNumArr:(NSMutableArray *)xNumArr oneXNumArr:(NSMutableArray *)oneXNumArr oneNumArr:(NSMutableArray *)oneNumArr twoNumArr:(NSMutableArray *)twoNumArr indexPath:(NSIndexPath *)indexPath {
    xArr = xNumArr;
    oXArr = oneXNumArr;
    oArr = oneNumArr;
    tArr = twoNumArr;

    
    self.barChart = [[ZFBarChart1 alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, _height)];
    self.barChart.dataSource = self;
    self.barChart.delegate = self;
    self.barChart.topicLabel.text = @"-";
    self.barChart.topicLabel.frame = CGRectMake(0, 0, 0, 0);
    self.barChart.frame = CGRectMake(0, 30, SCREEN_WIDTH, 210);
//    self.barChart.unit = @"人";
    self.barChart.isShadow = NO;
    self.barChart.isAnimated = YES;
    //    self.barChart.isResetAxisLineMinValue = YES;
    //    self.barChart.isResetAxisLineMaxValue = YES;
    //    self.barChart.isShowAxisLineValue = NO;
        self.barChart.valueLabelPattern = kPopoverLabelPatternBlank;
    self.barChart.isShowSeparate = YES;
    //    self.barChart.topicLabel.textColor = ZFWhite;
    //    self.barChart.unitColor = ZFWhite;
    //    self.barChart.axisColor = ZFWhite;
    //    self.barChart.axisLineNameColor = ZFWhite;
    //    self.barChart.axisLineValueColor = ZFWhite;
    //    self.barChart.backgroundColor = ZFPurple;
    [self addSubview:self.barChart];
    [self.barChart strokePath];

}
#pragma mark - ZFGenericChartDataSource

- (NSArray *)valueArrayInGenericChart:(ZFGenericChart1 *)chart{
    return oArr;
}

- (NSArray *)nameArrayInGenericChart:(ZFGenericChart1 *)chart{
    return xArr;
}

- (NSArray *)colorArrayInGenericChart:(ZFGenericChart1 *)chart{
    return @[[UIColor colorFromHexCode:@"#60a5e0"]];
}

//- (CGFloat)axisLineMaxValueInGenericChart:(ZFGenericChart1 *)chart{
//    return 500;
//}

//- (CGFloat)axisLineMinValueInGenericChart:(ZFGenericChart1 *)chart{
//    return 50;
//}

- (NSInteger)axisLineSectionCountInGenericChart:(ZFGenericChart1 *)chart{
    return 5;
}

#pragma mark - ZFBarChartDelegate

- (CGFloat)barWidthInBarChart:(ZFBarChart1 *)barChart{
    return 40.f;
}

- (CGFloat)paddingForGroupsInBarChart:(ZFBarChart1 *)barChart{
    return 50.f;
}

//- (id)valueTextColorArrayInBarChart:(ZFGenericChart1 *)barChart{
//    return ZFBlue;
//}

- (void)barChart:(ZFBarChart1 *)barChart didSelectBarAtGroupIndex:(NSInteger)groupIndex barIndex:(NSInteger)barIndex{
    NSLog(@"第%ld组========第%ld个",(long)groupIndex,(long)barIndex);
}

- (void)barChart:(ZFBarChart1 *)barChart didSelectPopoverLabelAtGroupIndex:(NSInteger)groupIndex labelIndex:(NSInteger)labelIndex{
    NSLog(@"第%ld组========第%ld个",(long)groupIndex,(long)labelIndex);
}




@end
